const router = require('koa-router')();

const cognito = require('./cognito');
const config = require('../config/config.local');

router.use('', cognito.routes(), cognito.allowedMethods());

router.get('/', async (ctx, next) => {
  await ctx.render('index', {
    title: 'Hello Koa 2! from pt-core-admin'
  })
});

router.get('/ver', async (ctx, next) => {
  const deploymentVersion = config.ver;
  ctx.body = `welcome, deployment version: ${deploymentVersion}`;
});


router.get('/string', async (ctx, next) => {
  ctx.body = 'koa2 string'
});

router.get('/json', async (ctx, next) => {
  ctx.body = {
    title: 'koa2 json'
  }
});

module.exports = router;
